<?php
namespace app\index\controller;
use app\index\controller\Base;
class Article extends Base
{
    public function index()
    {
        return $this->fetch('article');
    }
    public function getContent()
    {
        $id = input('id');
        $articleContent = db('article')->where('id',$id)->find();
        db('article')->where('id',$id)->setInc('click');
        $cateid = db('article')->where('id',$id)->column('cateid');
        // 获取相关推荐
        $relate = db('article')->where(array('state'=>1,'cateid'=>$cateid[0]))->select();
        $this->assign('articleContent',$articleContent);
        $this->assign('relate',$relate);
        return $this->fetch('article');
    }
}
